﻿using System.Reflection;

namespace EuphoricEngine3D.Helpers
{
    public static class EnumHelper
    {
        public static T[] GetEnumValues<T>()
        {
            if (!typeof(T).IsEnum)
                return null;

            FieldInfo[] fields = typeof(T).GetFields(BindingFlags.Static | BindingFlags.Public);
            T[] values = new T[fields.Length];

            for (int i = 0; i < fields.Length; i++)
                values[i] = (T)fields[i].GetValue(null);

            return values;
        }
    }
}